+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
+Sun Apr 1 03:28:14 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c: fixed a bunch of notifications, added
+ reference counts around emissions where the widget is used afterwards.
+ added freeze/thaws around multiple properties being notified.
+ (_gtk_widget_get_aux_info): cleanups.
+
+ * gtk/gtksettings.c (gtk_settings_install_property): provide
+ default parsing functions for gdkcolor, enums and flags.
+
+ * gtk/gtkwindow.[hc]: partially reverted patch from havoc,
+ applied by owen.
+ kept a flag in GtkWindowGeometryInfo to handle user
+ resetting default sizes.
+ cleaned up ZVT comments.
+ bunch of assorted bug fixes, notification fixes.
+ (_gtk_window_reposition): make this a really internal function.
+
+ * gtk/testgtk.c: fixups.
+
2001-03-31 Hans Breuer <hans@breuer.org>
* config.h.win32.in : disable USE_MMX for msvc build cause
GdkPixmap
GdkColormap
GtkSettings
- GtkRcStyle
GtkObject
GtkWidget
GtkMisc
@container: the object which received the signal.
@widget:
-<!-- ##### ARG GtkContainer:border-width ##### -->
+<!-- ##### ARG GtkContainer:resize-mode ##### -->
<para>
</para>
-<!-- ##### ARG GtkContainer:resize-mode ##### -->
+<!-- ##### ARG GtkContainer:border-width ##### -->
<para>
</para>
@arg1:
@arg2:
+<!-- ##### ARG GtkLayout:hadjustment ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG GtkLayout:vadjustment ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG GtkLayout:width ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG GtkLayout:height ##### -->
+<para>
+
+</para>
+
#GtkRcStyle structures to form a #GtkStyle.
</para>
+@parent_instance:
@name:
@bg_pixmap_name:
@font_desc:
the callbacks.
-<!-- ##### MACRO gtk_signal_lookup ##### -->
+<!-- ##### FUNCTION gtk_signal_lookup ##### -->
<para>
Given the name of the signal and the type of object it connects
to, get the signal's identifying integer. Emitting the signal
It also tries the ancestors of the given type.
</para>
-@Returns: the signal's identifying number, or 0 if no signal was found.
-<!-- # Unused Parameters # -->
@name: the signal's name, e.g. clicked.
@object_type: the type that the signal operates on, e.g. #GTK_TYPE_BUTTON.
+@Returns: the signal's identifying number, or 0 if no signal was found.
-<!-- ##### MACRO gtk_signal_name ##### -->
+<!-- ##### FUNCTION gtk_signal_name ##### -->
<para>
Given the signal's identifier, find its name.
</para>
Two different signals may have the same name, if they have differing types.
</para>
-@Returns: the signal name, or NULL if the signal number was invalid.
-<!-- # Unused Parameters # -->
@signal_id: the signal's identifying number.
+@Returns: the signal name, or NULL if the signal number was invalid.
<!-- ##### FUNCTION gtk_signal_emit ##### -->
followed by one which is a pointer to the return type.
-<!-- ##### MACRO gtk_signal_emit_stop ##### -->
+<!-- ##### FUNCTION gtk_signal_emit_stop ##### -->
<para>
This function aborts a signal's current emission.
</para>
isn't being emitted.
</para>
-@i:
-@s:
-<!-- # Unused Parameters # -->
@object: the object whose signal handlers you wish to stop.
@signal_id: the signal identifier, as returned by gtk_signal_lookup().
+<!-- # Unused Parameters # -->
+@i:
+@s:
<!-- ##### FUNCTION gtk_signal_emit_stop_by_name ##### -->
@name: the name of the signal you wish to stop.
-<!-- ##### MACRO gtk_signal_connect ##### -->
+<!-- ##### FUNCTION gtk_signal_connect ##### -->
<para>
Attach a function pointer and user data to a signal for
a particular object.
</programlisting>
</informalexample>
-@o:
-@s:
-@f:
-@d:
-@Returns: the connection id.
-<!-- # Unused Parameters # -->
@object: the object associated with the signal, e.g. if a button
is getting pressed, this is that button.
@name: name of the signal.
@func: function pointer to attach to the signal.
@func_data: value to pass as to your function (through the marshaller).
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_connect_after ##### -->
+<!-- ##### FUNCTION gtk_signal_connect_after ##### -->
<para>
Attach a function pointer and user data to a signal
so that this handler will be called after the other handlers.
</para>
-@o:
-@s:
-@f:
-@d:
-@Returns: the unique identifier for this attachment: the connection id.
-<!-- # Unused Parameters # -->
@object: the object associated with the signal.
@name: name of the signal.
@func: function pointer to attach to the signal.
@func_data: value to pass as to your function (through the marshaller).
+@Returns: the unique identifier for this attachment: the connection id.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_connect_object ##### -->
+<!-- ##### FUNCTION gtk_signal_connect_object ##### -->
<para>
This function is for registering a callback that will
call another object's callback. That is,
</programlisting>
</informalexample>
-@o:
-@s:
-@f:
-@d:
-@Returns: the connection id.
-<!-- # Unused Parameters # -->
@object: the object which emits the signal.
@name: the name of the signal.
@func: the function to callback.
@slot_object: the object to pass as the first parameter to func.
(Though it pretends to take an object, you can
really pass any gpointer as the #slot_object .)
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_connect_object_after ##### -->
+<!-- ##### FUNCTION gtk_signal_connect_object_after ##### -->
<para>
Attach a signal hook to a signal, passing in an alternate
object as the first parameter, and guaranteeing
handlers are called first.
</para>
-@o:
-@s:
-@f:
-@d:
-@Returns: the connection id.
-<!-- # Unused Parameters # -->
@object: the object associated with the signal.
@name: name of the signal.
@func: function pointer to attach to the signal.
@slot_object: the object to pass as the first parameter to #func.
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@f:
+@d:
<!-- ##### FUNCTION gtk_signal_connect_full ##### -->
@name: name of the signal.
-<!-- ##### MACRO gtk_signal_disconnect ##### -->
+<!-- ##### FUNCTION gtk_signal_disconnect ##### -->
<para>
Destroy a user-defined handler connection.
</para>
-<!-- # Unused Parameters # -->
@object: the object which the handler pertains to.
@handler_id: the connection id.
-<!-- ##### MACRO gtk_signal_disconnect_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_disconnect_by_func ##### -->
<para>
Destroy all connections for a particular object, with
the given function-pointer and user-data.
</para>
-@o:
-@f:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal.
@func: the function pointer to search for.
@data: the user data to search for.
+<!-- # Unused Parameters # -->
+@o:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_disconnect_by_data ##### -->
+<!-- ##### FUNCTION gtk_signal_disconnect_by_data ##### -->
<para>
Destroy all connections for a particular object, with
the given user-data.
</para>
-@o:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal.
@data: the user data to search for.
+<!-- # Unused Parameters # -->
+@o:
+@d:
-<!-- ##### MACRO gtk_signal_handler_block ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_block ##### -->
<para>
Prevent an user-defined handler from being invoked. All other
signal processing will go on as normal, but this particular
handler will ignore it.
</para>
-<!-- # Unused Parameters # -->
@object: the object which emits the signal to block.
@handler_id: the connection id.
-<!-- ##### MACRO gtk_signal_handler_block_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_block_by_func ##### -->
<para>
Prevent a user-defined handler from being invoked, by reference to
the user-defined handler's function pointer and user data. (It may result in
multiple hooks being blocked, if you've called connect multiple times.)
</para>
-@o:
-@f:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal to block.
@func: the function pointer of the handler to block.
@data: the user data of the handler to block.
+<!-- # Unused Parameters # -->
+@o:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_handler_block_by_data ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_block_by_data ##### -->
<para>
Prevent all user-defined handlers with a certain user data from being invoked.
</para>
-@o:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to block.
@data: the user data of the handlers to block.
+<!-- # Unused Parameters # -->
+@o:
+@d:
-<!-- ##### MACRO gtk_signal_handler_unblock ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_unblock ##### -->
<para>
Undo a block, by connection id. Note that undoing a block doesn't
necessarily make the hook callable, because if you block a
hook twice, you must unblock it twice.
</para>
-<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock.
@handler_id: the emission handler identifier, as returned by
gtk_signal_connect(), etc.
-<!-- ##### MACRO gtk_signal_handler_unblock_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_unblock_by_func ##### -->
<para>
Undo a block, by function pointer and data.
Note that undoing a block doesn't
hook twice, you must unblock it twice.
</para>
-@o:
-@f:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock.
@func: the function pointer to search for.
@data: the user data to search for.
+<!-- # Unused Parameters # -->
+@o:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_handler_unblock_by_data ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_unblock_by_data ##### -->
<para>
Undo block(s), to all signals for a particular object
with a particular user-data pointer
</para>
-@o:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock.
@data: the user data to search for.
+<!-- # Unused Parameters # -->
+@o:
+@d:
-<!-- ##### MACRO gtk_signal_handler_pending ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_pending ##### -->
<para>
Returns a connection id corresponding to a given signal id and object.
</para>
thus saving the cost of building the arguments.
</para>
-@i:
-@s:
-@b:
-@Returns: the connection id, if a connection was found. 0 otherwise.
-<!-- # Unused Parameters # -->
@object: the object to search for the desired user-defined handler.
@signal_id: the number of the signal to search for.
@may_be_blocked: whether it is acceptable to return a blocked
handler.
+@Returns: the connection id, if a connection was found. 0 otherwise.
+<!-- # Unused Parameters # -->
+@i:
+@s:
+@b:
-<!-- ##### MACRO gtk_signal_handler_pending_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_pending_by_func ##### -->
<para>
Returns a connection id corresponding to a given signal id, object, function
pointer and user data.
</para>
-@o:
-@s:
-@b:
-@f:
-@d:
-@Returns: the connection id, if a handler was found. 0 otherwise.
-<!-- # Unused Parameters # -->
@object: the object to search for the desired handler.
@signal_id: the number of the signal to search for.
@may_be_blocked: whether it is acceptable to return a blocked
handler.
@func: the function pointer to search for.
@data: the user data to search for.
+@Returns: the connection id, if a handler was found. 0 otherwise.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@b:
+@f:
+@d:
<!-- ##### MACRO gtk_signal_default_marshaller ##### -->
@Returns: a #GtkWidget.
+<!-- ##### FUNCTION gtk_spin_button_set_adjustment ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@adjustment:
+
+
+<!-- ##### FUNCTION gtk_spin_button_get_adjustment ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@Returns:
+
+
+<!-- ##### FUNCTION gtk_spin_button_set_digits ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@digits:
+
+
+<!-- ##### FUNCTION gtk_spin_button_get_value_as_float ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@Returns:
+
+
+<!-- ##### FUNCTION gtk_spin_button_get_value_as_int ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@Returns:
+
+
+<!-- ##### FUNCTION gtk_spin_button_set_value ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@value:
+
+
+<!-- ##### FUNCTION gtk_spin_button_set_update_policy ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@policy:
+
+
+<!-- ##### FUNCTION gtk_spin_button_set_numeric ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@numeric:
+
+
+<!-- ##### FUNCTION gtk_spin_button_spin ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@direction:
+@increment:
+
+
+<!-- ##### FUNCTION gtk_spin_button_set_wrap ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@wrap:
+
+
+<!-- ##### FUNCTION gtk_spin_button_set_snap_to_ticks ##### -->
+<para>
+
+</para>
+
+@spin_button:
+@snap_to_ticks:
+
+
+<!-- ##### FUNCTION gtk_spin_button_update ##### -->
+<para>
+
+</para>
+
+@spin_button:
+
+
<!-- ##### MACRO GTK_INPUT_ERROR ##### -->
<para>
@spinbutton: the object which received the signal.
@Returns:
+<!-- ##### SIGNAL GtkSpinButton::value-changed ##### -->
+<para>
+
+</para>
+
+@spinbutton: the object which received the signal.
+
<!-- ##### ARG GtkSpinButton:adjustment ##### -->
<para>
the #GtkAdjustment that defines a spin button's main properties.
@type_info: must not be null, and @type_info->type_name must also not be null.
-<!-- ##### MACRO gtk_type_name ##### -->
+<!-- ##### FUNCTION gtk_type_name ##### -->
<para>
</para>
-@Returns: a pointer to the name of a type, or NULL if it has none.
-<!-- # Unused Parameters # -->
@type: a GtkType
+@Returns: a pointer to the name of a type, or NULL if it has none.
-<!-- ##### MACRO gtk_type_from_name ##### -->
+<!-- ##### FUNCTION gtk_type_from_name ##### -->
<para>
Get the internal representation of a type given its name.
</para>
-@Returns: a GtkType
-<!-- # Unused Parameters # -->
@name: the name of a gtk type
+@Returns: a GtkType
-<!-- ##### MACRO gtk_type_parent ##### -->
+<!-- ##### FUNCTION gtk_type_parent ##### -->
<para>
</para>
-@Returns: the GtkType of the parent
-<!-- # Unused Parameters # -->
@type: a GtkType
+@Returns: the GtkType of the parent
<!-- ##### FUNCTION gtk_type_class ##### -->
@Returns: gpointer to a GtkTypeObject
-<!-- ##### MACRO gtk_type_is_a ##### -->
+<!-- ##### FUNCTION gtk_type_is_a ##### -->
<para>
Look in the type hierarchy to see if @type has @is_a_type among its
ancestors. Do so with a simple lookup, not a loop.
</para>
-@Returns:
-<!-- # Unused Parameters # -->
@type: GtkType
@is_a_type: GtkType
+@Returns:
<!-- ##### FUNCTION gtk_type_enum_get_values ##### -->
gtk_settings_install_property (GtkSettings *settings,
GParamSpec *pspec)
{
+ GtkRcPropertyParser parser = NULL;
+
g_return_if_fail (GTK_IS_SETTINGS (settings));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+
+ /* convenient automatic parser selection
+ */
+ if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GTK_TYPE_GDK_COLOR)
+ parser = gtk_rc_property_parse_color;
+ else if (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)) == G_TYPE_ENUM &&
+ G_TYPE_IS_DERIVED (G_PARAM_SPEC_VALUE_TYPE (pspec)))
+ parser = gtk_rc_property_parse_enum;
+ else if (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)) == G_TYPE_FLAGS &&
+ G_TYPE_IS_DERIVED (G_PARAM_SPEC_VALUE_TYPE (pspec)))
+ parser = gtk_rc_property_parse_flags;
- settings_install_property_parser (GTK_SETTINGS_GET_CLASS (settings), pspec, NULL);
+ settings_install_property_parser (GTK_SETTINGS_GET_CLASS (settings), pspec, parser);
}
void
static gboolean gtk_widget_real_activate_mnemonic (GtkWidget *widget,
gboolean group_cycling);
-static GtkWidgetAuxInfo* gtk_widget_aux_info_new (void);
static void gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info);
static void gtk_widget_do_uposition (GtkWidget *widget);
/* keep this function in sync with gtk_menu_detach()
*/
+ g_object_freeze_notify (G_OBJECT (widget));
+
/* unset focused and default children properly, this code
* should eventually move into some gtk_window_unparent_branch() or
* similar function.
gtk_widget_set_parent_window (widget, NULL);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], old_parent);
gtk_widget_propagate_hierarchy_changed (widget, NULL);
-
g_object_notify (G_OBJECT (widget), "parent");
+ g_object_thaw_notify (G_OBJECT (widget));
gtk_widget_unref (widget);
}
if (!GTK_WIDGET_VISIBLE (widget))
{
+ g_object_ref (G_OBJECT (widget));
if (!GTK_WIDGET_TOPLEVEL (widget))
gtk_widget_queue_resize (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
g_object_notify (G_OBJECT (widget), "visible");
+ g_object_unref (G_OBJECT (widget));
}
}
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_object_ref (G_OBJECT (widget));
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[GRAB_FOCUS]);
-
g_object_notify (G_OBJECT (widget), "has_focus");
+ g_object_unref (G_OBJECT (widget));
}
static void
if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
{
gtk_window_set_default (GTK_WINDOW (window), widget);
- g_object_notify (G_OBJECT (window), "has_default");
+ g_object_notify (G_OBJECT (widget), "has_default");
}
else
- g_warning("gtk_widget_grab_default() called on a widget not within a GtkWindow");
+ g_warning (G_STRLOC ": widget not within a GtkWindow");
}
/**
if (GTK_WIDGET_DRAWABLE (widget))
gtk_widget_queue_clear (widget);
- }
- g_object_notify (G_OBJECT (widget), "app_paintable");
+ g_object_notify (G_OBJECT (widget), "app_paintable");
+ }
}
/**
}
gtk_widget_set_style_internal (widget, style, initial_emission);
-
- g_object_notify (G_OBJECT (widget), "style");
}
/**
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (style != NULL);
+ g_object_ref (G_OBJECT (widget));
+ g_object_freeze_notify (G_OBJECT (widget));
+
if (widget->style != style || initial_emission)
{
PangoContext *context = gtk_widget_peek_pango_context (widget);
}
}
else if (initial_emission)
- {
- gtk_signal_emit (GTK_OBJECT (widget),
- widget_signals[STYLE_SET],
- NULL);
- }
+ gtk_signal_emit (GTK_OBJECT (widget),
+ widget_signals[STYLE_SET],
+ NULL);
+ g_object_notify (G_OBJECT (widget), "style");
+ g_object_thaw_notify (G_OBJECT (widget));
+ g_object_unref (G_OBJECT (widget));
}
static void
GtkWidgetAuxInfo *aux_info =_gtk_widget_get_aux_info (widget, FALSE);
if (GTK_IS_WINDOW (widget) && aux_info->x_set && aux_info->y_set)
- gtk_window_reposition (GTK_WINDOW (widget), aux_info->x, aux_info->y);
+ _gtk_window_reposition (GTK_WINDOW (widget), aux_info->x, aux_info->y);
if (GTK_WIDGET_VISIBLE (widget) && widget->parent)
gtk_widget_size_allocate (widget, &widget->allocation);
+ g_object_freeze_notify (G_OBJECT (widget));
if (aux_info->x_set)
g_object_notify (G_OBJECT (widget), "x");
if (aux_info->y_set)
g_object_notify (G_OBJECT (widget), "y");
+ g_object_thaw_notify (G_OBJECT (widget));
}
/**
g_return_if_fail (GTK_IS_WIDGET (widget));
aux_info =_gtk_widget_get_aux_info (widget, TRUE);
-
- /* keep this in sync with gtk_window_set_location() */
if (x > -2)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_object_freeze_notify (G_OBJECT (widget));
+
aux_info =_gtk_widget_get_aux_info (widget, TRUE);
if (width > -2)
- aux_info->width = width;
+ {
+ g_object_notify (G_OBJECT (widget), "width");
+ aux_info->width = width;
+ }
if (height > -2)
- aux_info->height = height;
+ {
+ g_object_notify (G_OBJECT (widget), "height");
+ aux_info->height = height;
+ }
if (GTK_WIDGET_VISIBLE (widget))
gtk_widget_queue_resize (widget);
- if (width > -2)
- g_object_notify (G_OBJECT (widget), "width");
- if (height > -2)
- g_object_notify (G_OBJECT (widget), "height");
+ g_object_thaw_notify (G_OBJECT (widget));
}
/**
* Return value: the #GtkAuxInfo structure for the widget, or
* %NULL if @create is %FALSE and one doesn't already exist.
**/
-GtkWidgetAuxInfo *
+GtkWidgetAuxInfo*
_gtk_widget_get_aux_info (GtkWidget *widget,
gboolean create)
{
aux_info = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_aux_info);
if (!aux_info && create)
{
- aux_info = gtk_widget_aux_info_new ();
+ if (!aux_info_mem_chunk)
+ aux_info_mem_chunk = g_mem_chunk_new ("widget aux info mem chunk",
+ sizeof (GtkWidgetAuxInfo),
+ 1024, G_ALLOC_AND_FREE);
+ aux_info = g_chunk_new (GtkWidgetAuxInfo, aux_info_mem_chunk);
+
+ aux_info->width = -1;
+ aux_info->height = -1;
+ aux_info->x = 0;
+ aux_info->y = 0;
+ aux_info->x_set = FALSE;
+ aux_info->y_set = FALSE;
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_aux_info, aux_info);
-
- aux_info->width = aux_info->height = -1;
- aux_info->x = aux_info->y = 0;
- aux_info->x_set = aux_info->y_set = FALSE;
}
return aux_info;
}
-/*****************************************
- * gtk_widget_aux_info_new:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static GtkWidgetAuxInfo*
-gtk_widget_aux_info_new (void)
-{
- GtkWidgetAuxInfo *aux_info;
-
- if (!aux_info_mem_chunk)
- aux_info_mem_chunk = g_mem_chunk_new ("widget aux info mem chunk",
- sizeof (GtkWidgetAuxInfo),
- 1024, G_ALLOC_AND_FREE);
-
- aux_info = g_chunk_new (GtkWidgetAuxInfo, aux_info_mem_chunk);
-
- aux_info->x = -1;
- aux_info->y = -1;
- aux_info->width = 0;
- aux_info->height = 0;
-
- return aux_info;
-}
-
/*****************************************
* gtk_widget_aux_info_destroy:
*
#include "gtkiconfactory.h"
#include "gtkintl.h"
-/* TODO: remove this define and assorted code in 1.3 and fix up the
- * real culprits.
- */
-#define FIXME_ZVT_ME_HARDER
-
enum {
SET_FOCUS,
FRAME_EVENT,
PROP_DEFAULT_WIDTH,
PROP_DEFAULT_HEIGHT,
PROP_DESTROY_WITH_PARENT,
-
+
LAST_ARG
};
gint height;
} GtkWindowLastGeometryInfo;
-typedef struct {
+struct _GtkWindowGeometryInfo
+{
/* Properties that the app has set on the window
*/
GdkGeometry geometry; /* Geometry hints */
GdkWindowHints mask;
GtkWidget *widget; /* subwidget to which hints apply */
- gint width; /* gtk_window_set_default_size () */
+ gint width; /* Default size */
gint height;
+ guint may_shrink : 1; /* one-shot auto_shrink behaviour after set_default_size */
GtkWindowLastGeometryInfo last;
-} GtkWindowGeometryInfo;
+};
typedef struct {
GtkWindow *window;
static void gtk_window_compute_hints (GtkWindow *window,
GdkGeometry *new_geometry,
guint *new_flags);
-static gboolean gtk_window_compute_reposition (GtkWindow *window,
- gint new_width,
- gint new_height,
- gint *x,
- gint *y);
+static gint gtk_window_compute_reposition (GtkWindow *window,
+ gint new_width,
+ gint new_height,
+ gint *x,
+ gint *y);
static void gtk_window_read_rcfiles (GtkWidget *widget,
GdkEventClient *event);
static GtkWindowGeometryInfo* gtk_window_get_geometry_info (GtkWindow *window,
gboolean create);
-static void gtk_window_geometry_destroy (GtkWindowGeometryInfo *info);
static GSList *toplevel_list = NULL;
window->title = NULL;
window->wmclass_name = g_strdup (g_get_prgname ());
window->wmclass_class = g_strdup (gdk_progclass);
+ window->wm_role = NULL;
+ window->geometry_info = NULL;
window->type = GTK_WINDOW_TOPLEVEL;
window->focus_widget = NULL;
window->default_widget = NULL;
}
void
-gtk_window_reposition (GtkWindow *window,
- gint x,
- gint y)
+_gtk_window_reposition (GtkWindow *window,
+ gint x,
+ gint y)
{
GtkWindowGeometryInfo *info;
g_object_notify (G_OBJECT (window), "destroy_with_parent");
}
-static void
-gtk_window_geometry_destroy (GtkWindowGeometryInfo *info)
-{
- if (info->widget)
- gtk_signal_disconnect_by_func (GTK_OBJECT (info->widget),
- GTK_SIGNAL_FUNC (gtk_widget_destroyed),
- &info->widget);
- g_free (info);
-}
-
static GtkWindowGeometryInfo*
gtk_window_get_geometry_info (GtkWindow *window,
gboolean create)
{
GtkWindowGeometryInfo *info;
- info = gtk_object_get_data (GTK_OBJECT (window), "gtk-window-geometry");
-
+ info = window->geometry_info;
if (!info && create)
{
info = g_new0 (GtkWindowGeometryInfo, 1);
info->last.height = -1;
info->widget = NULL;
info->mask = 0;
-
- gtk_object_set_data_full (GTK_OBJECT (window),
- "gtk-window-geometry",
- info,
- (GtkDestroyNotify) gtk_window_geometry_destroy);
+ info->may_shrink = FALSE;
+ window->geometry_info = info;
}
return info;
info = gtk_window_get_geometry_info (window, TRUE);
+ g_object_freeze_notify (G_OBJECT (window));
if (width >= 0)
- info->width = width;
- if (height >= 0)
- info->height = height;
-
- if (width >= 0)
- g_object_notify (G_OBJECT (window), "width");
+ {
+ info->width = width;
+ g_object_notify (G_OBJECT (window), "default_width");
+ info->may_shrink = TRUE;
+ }
if (height >= 0)
- g_object_notify (G_OBJECT (window), "height");
-
- if (GTK_WIDGET_REALIZED (window) && window->allow_grow)
{
- /* Resize as if the user had resized */
- GdkGeometry new_geometry;
- GdkWindowHints new_flags;
-
- gtk_window_compute_hints (window, &new_geometry, &new_flags);
- gtk_window_constrain_size (window,
- &new_geometry, new_flags,
- width, height,
- &width, &height);
-
- gdk_window_resize (GTK_WIDGET (window)->window,
- width, height);
+ info->height = height;
+ g_object_notify (G_OBJECT (window), "default_height");
+ info->may_shrink = TRUE;
}
- else
- gtk_widget_queue_resize (GTK_WIDGET (window));
+ g_object_thaw_notify (G_OBJECT (window));
+
+ gtk_widget_queue_resize (GTK_WIDGET (window));
}
static void
g_free (window->title);
g_free (window->wmclass_name);
g_free (window->wmclass_class);
+ g_free (window->wm_role);
g_hash_table_foreach_remove (mnemonic_hash_table,
gtk_window_mnemonic_hash_remove,
window);
+ if (window->geometry_info)
+ {
+ if (window->geometry_info->widget)
+ gtk_signal_disconnect_by_func (GTK_OBJECT (window->geometry_info->widget),
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+ &window->geometry_info->widget);
+ g_free (window->geometry_info);
+ }
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GtkWindow *window = GTK_WINDOW (widget);
GtkContainer *container = GTK_CONTAINER (window);
gboolean need_resize;
- gboolean was_realized;
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
GtkAllocation allocation = { 0, 0 };
GdkGeometry new_geometry;
guint width, height, new_flags;
+ gboolean was_realized;
/* determine default size to initially show the window with */
gtk_widget_size_request (widget, NULL);
}
/* Must be done after the windows are realized,
- so that the decorations can be read */
+ * so that the decorations can be read
+ */
gtk_decorated_window_calculate_frame_size (window);
if (!was_realized)
GtkWindowLastGeometryInfo saved_last_info;
GdkGeometry new_geometry;
guint new_flags;
- gboolean need_reposition;
gint x, y;
gint width, height;
gint new_width, new_height;
+ gboolean need_reposition;
gboolean default_size_changed = FALSE;
gboolean hints_changed = FALSE;
+ gboolean may_shrink = window->auto_shrink;
- g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GTK_WIDGET_REALIZED (window));
widget = GTK_WIDGET (window);
info->last.height != new_height)
{
default_size_changed = TRUE;
+ may_shrink |= info->may_shrink;
info->last.width = new_width;
info->last.height = new_height;
if (window->position == GTK_WIN_POS_CENTER_ALWAYS)
window->use_uposition = TRUE;
}
+ info->may_shrink = FALSE;
/* Compute new set of hints for the window
*/
/* From the default size and the allocation, figure out the size
* the window should be.
*/
- if (!window->auto_shrink &&
- (!default_size_changed ||
- (new_width <= widget->allocation.width &&
- new_height <= widget->allocation.height)))
+ if (!default_size_changed ||
+ (!may_shrink &&
+ new_width <= widget->allocation.width &&
+ new_height <= widget->allocation.height))
{
new_width = widget->allocation.width;
new_height = widget->allocation.height;
gtk_widget_size_allocate (widget, &allocation);
gtk_widget_queue_draw (widget);
-#ifdef FIXME_ZVT_ME_HARDER
if ((default_size_changed || hints_changed) && (width != new_width || height != new_height))
{
/* We could be here for two reasons
* another resize.
* 2) Our computation of default_size_changed was completely
* screwed up, probably because one of our children
- * is broken (i.e. changes requisition during
- * size allocation). It's probably a zvt widget.
+ * is changed requisition during size allocation).
*
* For 1), we could just go ahead and ask for the
* new size right now, but doing that for 2)
/* we have to preserve the values and flags that are used
* for computation of default_size_changed and hints_changed
*/
-
info->last = saved_last_info;
gtk_widget_queue_resize (widget);
return;
}
-#endif /* FIXME_ZVT_ME_HARDER */
}
/* Now set hints if necessary
return FALSE;
if ((flags_a & GDK_HINT_WIN_GRAVITY) &&
- (geometry_a->win_gravity != geometry_b->win_gravity))
+ geometry_a->win_gravity != geometry_b->win_gravity)
return FALSE;
-
+
return TRUE;
}
gint *new_width,
gint *new_height)
{
- GtkWindowGeometryInfo *info = (GtkWindowGeometryInfo *)gtk_object_get_data (GTK_OBJECT (window), "gtk-window-geometry");
-
+ GtkWindowGeometryInfo *info;
+
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ info = window->geometry_info;
if (info)
{
GdkWindowHints flags = info->last.flags;
/* Compute a new position for the window based on a new
* size. *x and *y will be set to the new coordinates. Returns
- * TRUE if the window needs to be moved;
+ * TRUE if the window needs to be moved (and thus x and y got
+ * assigned)
*/
-static gboolean
-gtk_window_compute_reposition (GtkWindow *window,
- gint new_width,
- gint new_height,
- gint *x,
- gint *y)
+static gint
+gtk_window_compute_reposition (GtkWindow *window,
+ gint new_width,
+ gint new_height,
+ gint *x,
+ gint *y)
{
- GtkWidget *widget;
+ GtkWidget *widget = GTK_WIDGET (window);
GtkWindowPosition pos;
GtkWidget *parent_widget;
- gboolean result = FALSE;
-
- widget = GTK_WIDGET (window);
+ gboolean needs_move = FALSE;
parent_widget = (GtkWidget*) window->transient_parent;
*x = (screen_width - new_width) / 2;
*y = (screen_height - new_height) / 2;
-
- result = TRUE;
+ needs_move = TRUE;
}
break;
*x = ox + (parent_widget->allocation.width - new_width) / 2;
*y = oy + (parent_widget->allocation.height - new_height) / 2;
-
- result = TRUE;
- }
+ needs_move = TRUE;
+ }
break;
case GTK_WIN_POS_MOUSE:
*y -= new_height / 2;
*x = CLAMP (*x, 0, screen_width - new_width);
*y = CLAMP (*y, 0, screen_height - new_height);
-
- result = TRUE;
+ needs_move = TRUE;
}
break;
default:
if (window->use_uposition)
{
GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
+
if (aux_info && aux_info->x_set && aux_info->y_set)
{
*x = aux_info->x;
*y = aux_info->y;
+ needs_move = TRUE;
}
-
- result = TRUE;
}
break;
}
- if (result)
+ if (needs_move)
{
GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, TRUE);
-
- aux_info->x_set = aux_info->y_set = TRUE;
+
+ /* we handle necessary window positioning by hand here,
+ * so we can coalesce the window movement with possible
+ * resizes to get only one configure event.
+ */
+ aux_info->x_set = TRUE;
+ aux_info->y_set = TRUE;
aux_info->x = *x;
aux_info->y = *y;
-
window->use_uposition = FALSE;
}
- return result;
+ return needs_move;
}
/***********************
/**
* gtk_window_set_resizeable:
* @window: a #GtkWindow
- * @setting: %TRUE if the user can resize this window
+ * @resizeable: %TRUE if the user can resize this window
*
* Sets whether the user can resize a window. Windows are user resizeable
* by default.
- *
**/
void
gtk_window_set_resizeable (GtkWindow *window,
- gboolean setting)
+ gboolean resizeable)
{
g_return_if_fail (GTK_IS_WINDOW (window));
- if (setting)
- gtk_window_set_policy (window, FALSE, TRUE, FALSE);
- else
- gtk_window_set_policy (window, FALSE, FALSE, TRUE);
+ gtk_window_set_policy (window, FALSE, resizeable, FALSE);
}
/**
* gtk_window_get_resizeable:
* @window: a #GtkWindow
- *
+ *
* Gets the value set by gtk_window_set_resizeable().
- *
+ *
* Return value: %TRUE if the user can resize the window
**/
gboolean
return window->allow_grow;
}
-
-/**
- * gtk_window_set_size:
- * @window: a #GtkWindow
- * @width: width, or -1 to use the default width
- * @height: height, or -1 to use the default height
- *
- * Sets the size of @window, but only works for resizeable windows
- * (see gtk_window_set_resizeable()). Setting the size emulates a user
- * resize operation. Therefore, setting the size less than the minimum
- * size for the window will simply make the window its minimum size,
- * and the user will be able to change the size that's set.
- *
- * This call also sets the default size of the window, so replaces
- * gtk_window_set_default_size().
- *
- * To set a minimum size, or to set the size of a non-resizeable window,
- * use gtk_widget_set_usize() on the window. Though normally it makes
- * more sense to instead call gtk_widget_set_usize() on a child widget inside
- * the window, rather than the window itself.
- *
- * Under the X Window System, window managers are allowed to ignore GTK+'s
- * request to change a window's size. So your program should not rely on
- * getting a specific size. (And, as noted in gtk_window_get_size(),
- * a program that crucially relies on a specific size will generally have
- * race conditions and be buggy anyway - rather than assuming a
- * call to gtk_window_set_size() has taken effect, you should react
- * to configure_event signals on your #GtkWindow.)
- *
- * If you set a geometry widget for the window with
- * gtk_window_set_geometry_hints(), the size applies to the geometry
- * widget, not the window itself.
- *
- * If you've called the deprecated gtk_window_set_policy() function,
- * gtk_window_set_size() may not behave as expected, due to interaction
- * with window policies.
- **/
-void
-gtk_window_set_size (GtkWindow *window,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_WINDOW (window));
- g_return_if_fail (width != 0);
- g_return_if_fail (height != 0);
-
- /* set_default_size() uses "0" to mean "unset", but we allow "-1"
- * for that in this newer function
- */
- if (width < 0)
- width = 0;
- if (height < 0)
- height = 0;
-
- gtk_window_set_default_size (window, width, height);
-}
-
-/**
- * gtk_window_get_size:
- * @window: a #GtkWindow
- * @width: return location for current width, or %NULL
- * @height: return location for current height, or %NULL
- *
- * Obtains the current size of @window. If the window is not onscreen
- * (i.e. has not been received its first configure_event after being
- * shown with gtk_widget_show()), the size will be the size GTK+ will
- * request for this window when it's shown. The window manager may
- * not choose to give the window exactly this requested size.
- *
- * In general, code which depends on window size should connect to the
- * configure_event on the window so that it can respond to changes in
- * size caused by the user or by the window manager, in addition to
- * changes in size created by your program.
- *
- * If you set a geometry widget for the window with
- * gtk_window_set_geometry_hints(), the size retrieved is the size of
- * the geometry widget, not the window itself.
- *
- **/
-void
-gtk_window_get_size (GtkWindow *window,
- gint *width,
- gint *height)
-{
- GtkWindowGeometryInfo *info;
- GtkWidget *widget = GTK_WIDGET (window);
-
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- if (GTK_WIDGET_REALIZED (window))
- {
- gdk_window_get_size (GTK_WIDGET (window)->window,
- width, height);
- }
- else
- {
- GdkGeometry new_geometry;
- GdkWindowHints new_flags;
- gint w, h;
-
- gtk_widget_size_request (widget, NULL);
- gtk_window_compute_default_size (window, &w, &h);
-
- gtk_window_compute_hints (window, &new_geometry, &new_flags);
- gtk_window_constrain_size (window,
- &new_geometry, new_flags,
- w, h,
- &w, &h);
-
- if (width)
- *width = w;
- if (height)
- *height = h;
- }
-
- info = gtk_window_get_geometry_info (window, TRUE);
- if (info->widget)
- {
- gint extra_width = widget->requisition.width - info->widget->requisition.width;
- gint extra_height = widget->requisition.height - info->widget->requisition.height;
-
- if (width)
- *width -= extra_width;
- if (height)
- *height -= extra_height;
- }
-}
-
-/**
- * gtk_window_set_location:
- * @window: a #GtkWindow
- * @root_x: X position of gravity-determined reference point in root window coordinates
- * @root_y: Y position of gravity-determined reference point in root window coordinates
- *
- * Requests a new position for a #GtkWindow. The position is given in
- * root window coordinates, and is the position of the window's
- * "reference point" as determined by the window gravity (see
- * gtk_window_set_gravity()). By default, the reference point is the
- * northwest (top left) corner of the window's titlebar. So if you
- * set the window position to (0,0), the window's titlebar will end up
- * in the top left corner of the root window. Note that the root
- * window does not always correspond to the user's desktop area, so
- * you may want to call gdk_workspace_get_extents() or
- * gdk_desktop_get_extents() to decide where to place a window. The
- * extents of the root window can be obtained using gdk_screen_width()
- * and gdk_screen_height().
- *
- **/
-void
-gtk_window_set_location (GtkWindow *window,
- gint root_x,
- gint root_y)
-{
- GtkWidgetAuxInfo *aux_info;
-
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- aux_info = _gtk_widget_get_aux_info (GTK_WIDGET (window), TRUE);
-
- aux_info->x_set = aux_info->y_set = TRUE;
- aux_info->x = root_x;
- aux_info->y = root_y;
-
- gtk_window_reposition (window, root_x, root_y);
-}
-
-/**
- * gtk_window_get_location:
- * @window: a #GtkWindow
- * @root_x: return location for X coordinate of gravity-determined reference point
- * @root_y: return location for Y coordinate of gravity-determined reference point
- *
- * Attempts to obtain the current position of the reference point, as
- * set by gtk_window_set_position(). This computation is accurate when
- * the reference point is a corner of the window itself (as with
- * #GDK_GRAVITY_STATIC), but may not be accurate when the reference
- * point is a position on the titlebar or window border, because the X
- * Window System does not provide a reliable way of obtaining this
- * information. GTK+ will do a "best guess" which may not be fully
- * accurate with some window managers, but will probably be
- * reasonable.
- *
- **/
-void
-gtk_window_get_location (GtkWindow *window,
- gint *root_x,
- gint *root_y)
-{
- GdkRectangle frame_extents;
- GtkWidget *widget;
- GtkWidgetAuxInfo *aux_info;
-
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- widget = GTK_WIDGET (window);
-
- if (GTK_WIDGET_REALIZED (window))
- {
- if (window->gravity == GDK_GRAVITY_STATIC)
- {
- gdk_window_get_origin (widget->window, root_x, root_y);
- return;
- }
- else
- {
- gint x, y;
-
- gdk_window_get_frame_extents (widget->window, &frame_extents);
-
- x = frame_extents.x;
- y = frame_extents.y;
-
- switch (window->gravity)
- {
- case GDK_GRAVITY_NORTH:
- case GDK_GRAVITY_CENTER:
- case GDK_GRAVITY_SOUTH:
- x += frame_extents.width / 2;
- break;
- case GDK_GRAVITY_SOUTH_EAST:
- case GDK_GRAVITY_EAST:
- case GDK_GRAVITY_NORTH_EAST:
- x += frame_extents.width;
- break;
- default:
- break;
- }
-
- switch (window->gravity)
- {
- case GDK_GRAVITY_WEST:
- case GDK_GRAVITY_CENTER:
- case GDK_GRAVITY_EAST:
- y += frame_extents.height / 2;
- break;
- case GDK_GRAVITY_SOUTH_WEST:
- case GDK_GRAVITY_SOUTH:
- case GDK_GRAVITY_SOUTH_EAST:
- y += frame_extents.height;
- break;
- default:
- break;
- }
-
- if (root_x)
- *root_x = x;
- if (root_y)
- *root_y = y;
- }
- }
- else
- {
- /* We really don't have a location yet, so we make up some stuff,
- * using the uposition if it's been set.
- */
- if (root_x)
- *root_x = 0;
-
- if (root_y)
- *root_y = 0;
-
- aux_info = _gtk_widget_get_aux_info (widget, FALSE);
- if (aux_info && aux_info->x_set && aux_info->y_set)
- {
- *root_x = aux_info->x;
- *root_y = aux_info->y;
- }
- }
-}
-
/**
* gtk_window_set_gravity:
* @window: a #GtkWindow
*
* Window gravity defines the "reference point" to be used when
* positioning or resizing a window. Calls to
- * gtk_window_set_position() will position a different point on the
+ * gtk_widget_set_uposition() will position a different point on the
* window depending on the window gravity. When the window changes size
* the reference point determined by the window's gravity will stay in
* a fixed location.
* itself.
*
* The default window gravity is #GDK_GRAVITY_NORTH_WEST.
- *
+ *
**/
void
gtk_window_set_gravity (GtkWindow *window,
- GdkGravity gravity)
+ GdkGravity gravity)
{
g_return_if_fail (GTK_IS_WINDOW (window));
{
window->gravity = gravity;
- /* This is sort of odd, but it keeps the hints recomputation
- * in one place. Otherwise we're likely to mess up the
- * recording of the last hints, etc.
+ /* gtk_window_move_resize() will adapt gravity
*/
gtk_widget_queue_resize (GTK_WIDGET (window));
}
/**
* gtk_window_get_gravity:
* @window: a #GtkWindow
- *
+ *
* Gets the value set by gtk_window_set_gravity().
- *
+ *
* Return value: window gravity
**/
GdkGravity
timestamp);
}
+
/**
* gtk_window_begin_move_drag:
* @button: mouse button that initiated the drag
#define GTK_WINDOW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
-typedef struct _GtkWindow GtkWindow;
-typedef struct _GtkWindowClass GtkWindowClass;
+typedef struct _GtkWindow GtkWindow;
+typedef struct _GtkWindowClass GtkWindowClass;
+typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
struct _GtkWindow
{
gchar *wmclass_name;
gchar *wmclass_class;
gchar *wm_role;
- GtkWindowType type;
- GdkWindow *frame;
-
GtkWidget *focus_widget;
GtkWidget *default_widget;
GtkWindow *transient_parent;
+ GtkWindowGeometryInfo *geometry_info;
+ GdkWindow *frame;
- gushort resize_count;
+ guint16 resize_count;
+
+ GtkWindowType type : 4;
guint has_user_ref_count : 1;
guint allow_shrink : 1;
guint allow_grow : 1;
guint iconify_initially : 1;
guint stick_initially : 1;
guint maximize_initially : 1;
-
guint decorated : 1;
GdkWindowTypeHint type_hint : 3;
-
GdkGravity gravity : 5;
guint frame_left;
void gtk_window_set_functions_hint (GtkWindow *window,
GdkWMFunction functions);
-
void gtk_window_set_resizeable (GtkWindow *window,
- gboolean setting);
+ gboolean resizeable);
gboolean gtk_window_get_resizeable (GtkWindow *window);
-
-void gtk_window_set_size (GtkWindow *window,
- gint width,
- gint height);
-void gtk_window_get_size (GtkWindow *window,
- gint *width,
- gint *height);
-
-void gtk_window_set_location (GtkWindow *window,
- gint root_x,
- gint root_y);
-void gtk_window_get_location (GtkWindow *window,
- gint *root_x,
- gint *root_y);
-
void gtk_window_set_gravity (GtkWindow *window,
GdkGravity gravity);
GdkGravity gtk_window_get_gravity (GtkWindow *window);
gchar *msg;
gint x, y;
- gtk_window_get_location (GTK_WINDOW (widget), &x, &y);
+ x = widget->allocation.x;
+ y = widget->allocation.y;
msg = g_strdup_printf ("event: %d,%d %d x %d\n"
"location: %d, %d",
get_ints (data, &w, &h);
- gtk_window_set_size (g_object_get_data (data, "target"),
- w, h);
+ gtk_window_set_default_size (GTK_WINDOW (g_object_get_data (data, "target")), w, h);
}
static void
get_ints (data, &x, &y);
- gtk_window_set_location (g_object_get_data (data, "target"),
- x, y);
+ gtk_widget_set_uposition (g_object_get_data (data, "target"), x, y);
}
static void
gravity_selected (GtkWidget *widget,
gpointer data)
{
- gtk_window_set_gravity (G_OBJECT (g_object_get_data (data, "target")),
+ gtk_window_set_gravity (GTK_WINDOW (g_object_get_data (data, "target")),
gtk_option_menu_get_history (GTK_OPTION_MENU (widget)) + GDK_GRAVITY_NORTH_WEST);
}
while (i < 10)
{
GtkWidget *mi;
- static gchar *names[10] = {
+ static gchar *names[] = {
"GDK_GRAVITY_NORTH_WEST",
"GDK_GRAVITY_NORTH",
"GDK_GRAVITY_NORTH_EAST",
gchar *msg;
gint x, y;
- gtk_window_get_location (GTK_WINDOW (widget), &x, &y);
+ x = widget->allocation.x;
+ y = widget->allocation.y;
msg = g_strdup_printf ("event: %d,%d %d x %d\n"
"location: %d, %d",
get_ints (data, &w, &h);
- gtk_window_set_size (g_object_get_data (data, "target"),
- w, h);
+ gtk_window_set_default_size (GTK_WINDOW (g_object_get_data (data, "target")), w, h);
}
static void
get_ints (data, &x, &y);
- gtk_window_set_location (g_object_get_data (data, "target"),
- x, y);
+ gtk_widget_set_uposition (g_object_get_data (data, "target"), x, y);
}
static void
gravity_selected (GtkWidget *widget,
gpointer data)
{
- gtk_window_set_gravity (G_OBJECT (g_object_get_data (data, "target")),
+ gtk_window_set_gravity (GTK_WINDOW (g_object_get_data (data, "target")),
gtk_option_menu_get_history (GTK_OPTION_MENU (widget)) + GDK_GRAVITY_NORTH_WEST);
}
while (i < 10)
{
GtkWidget *mi;
- static gchar *names[10] = {
+ static gchar *names[] = {
"GDK_GRAVITY_NORTH_WEST",
"GDK_GRAVITY_NORTH",
"GDK_GRAVITY_NORTH_EAST",